home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / smail-3.1.28 / src / default.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-20  |  43.8 KB  |  1,312 lines

  1. /* @(#)src/default.c    1.21 9/20/92 16:10:31 */
  2.  
  3. /*
  4.  *    Copyright (C) 1987, 1988 Ronald S. Karr and Landon Curt Noll
  5.  *    Copyright (C) 1992  Ronald S. Karr
  6.  * 
  7.  * See the file COPYING, distributed with smail, for restriction
  8.  * and warranty information.
  9.  */
  10.  
  11. /*
  12.  * default:
  13.  *    default values to be used in the event that no other info is given
  14.  *
  15.  * Items are placed in this file ONLY if they represent the default behavior
  16.  * of smail and it's utilities, and ONLY if the default behavior can be changed
  17.  * by `config.h' or the `startup' file.
  18.  */
  19. #include <stdio.h>
  20. #include "defs.h"
  21. #include "config.h"
  22. #include "smail.h"
  23. #include "direct.h"
  24. #include "route.h"
  25. #include "transport.h"
  26. #ifndef DEPEND
  27. # include "extern.h"
  28. #endif
  29. #include "directors/include.h"
  30. #include "directors/aliasfile.h"
  31. #include "directors/fwdfile.h"
  32. #include "directors/user.h"
  33. #include "directors/smartuser.h"
  34. #include "routers/gethost.h"
  35. #include "routers/uuname.h"
  36. #include "routers/pathalias.h"
  37. #include "routers/smarthost.h"
  38. #include "routers/reroute.h"
  39. #include "transports/pipe.h"
  40. #include "transports/appendfile.h"
  41. #include "transports/tcpsmtp.h"
  42. #include "transports/smtplib.h"
  43.  
  44. /*
  45.  * SUCC is set to point to the previously defined director, router or
  46.  * transport, and is redefined after each new definition, to make it
  47.  * simpler to optionally include links in the various configuration
  48.  * chains.
  49.  *
  50.  * NOTE:  directors, routers and transports are listed in reverse order.
  51.  *      This causes `forward' links to work without declaring them in
  52.  *      advance.
  53.  */
  54.  
  55.  
  56. /*
  57.  * START OF DIRECTOR DEFINITION SECTION
  58.  */
  59.  
  60. #undef SUCC
  61. #define SUCC    NULL            /* end of director list */
  62.  
  63. #ifdef SMART_USER
  64. static struct smartuser_private smartuser_director_priv = {
  65.     SMART_USER,                /* address for unknown users */
  66. };
  67.  
  68. static struct director smartuser_director = {
  69.     "smart_user",            /* mailing lists */
  70.     "smartuser",            /* use the smartuser driver */
  71.     SUCC,                /* point to next director */
  72.     SMARTUSER_WELLFORMED,        /* no interesting flags */
  73.     NULL,                /* no address owner */
  74.     NULL,                /* no default user */
  75.     NULL,                /* no default group */
  76.     NULL,                /* no default home director */
  77.     NULL,                /* no explicit user */
  78.     NULL,                /* no explicit group */
  79.     NULL,                /* no explicit home directory */
  80.     (char *)&smartuser_director_priv,    /* local private configuration */
  81.     0,                    /* cache - default uid */
  82.     0,                    /* cache - default gid */
  83.     NULL,                /* cache - expanded default home */
  84.     0,                    /* cache - set uid */
  85.     0,                    /* cache - set gid */
  86.     NULL,                /* cache - expanded set home */
  87. };
  88. # undef SUCC
  89. # define SUCC (&smartuser_director)    /* setup for forward link */
  90. #endif    /* SMART_USER */
  91.  
  92.  
  93. #ifdef LIST_FILENAME
  94. /*
  95.  * LIST DIRECTOR:
  96.  *
  97.  * This matches mailing lists files stored in the defined mailing list
  98.  * directory.
  99.  */
  100. static struct forwardfile_private list_director_priv = {
  101.     LIST_FILENAME,            /* file in mailing list directory */
  102.     0,                    /* don't worry about file modes */
  103.     NULL,                /* no specific caution warnings */
  104.     NULL,                /* no specific unsecure areas */
  105.     NULL,                /* anybody can own these */
  106.     NULL,                /* any group can own these */
  107.     NULL,                /* no prefix */
  108.     NULL,                /* no suffix */
  109. };
  110.  
  111. static struct director list_director = {
  112.     "lists",                /* mailing lists */
  113.     "forwardfile",            /* use the forwardfile driver */
  114.     SUCC,                /* point to next director */
  115. #if !defined(LISTS_REMOVE_SENDER)
  116.     SENDER_OKAY |
  117. #endif
  118.     CAUTION_DIRECTOR|NOBODY_DIRECTOR,    /* no interesting flags */
  119.     "owner-$user",            /* normal address owner owners */
  120.     NULL,                /* no default user */
  121.     NULL,                /* no default group */
  122.     NULL,                /* no default home director */
  123.     NULL,                /* no explicit user */
  124.     NULL,                /* no explicit group */
  125.     NULL,                /* no explicit home directory */
  126.     (char *)&list_director_priv,    /* local private configuration */
  127.     0,                    /* cache - default uid */
  128.     0,                    /* cache - default gid */
  129.     NULL,                /* cache - expanded default home */
  130.     0,                    /* cache - set uid */
  131.     0,                    /* cache - set gid */
  132.     NULL,                /* cache - expanded set home */
  133. };
  134. # undef SUCC
  135. # define SUCC (&list_director)        /* setup for forward link */
  136. #endif    /* LIST_FILENAME */
  137.  
  138.  
  139. /*
  140.  * REAL_USER DIRECTOR:
  141.  *
  142.  * This matches users on the local host, with a prefix of "real-" and
  143.  * associates them with the transport that appends to user mailbox
  144.  * files.
  145.  *
  146.  * This director allows a user's mailbox to specified literally with
  147.  * a form that won't go through aliasing or forwarding (generally).
  148.  * This is useful in scenarios that cannot easily be solved without
  149.  * mail loops, such as people who wish all mail to be forwarded to
  150.  * multiple machines.
  151.  */
  152. static struct user_private real_user_director_priv = {
  153.     "local",                /* use the local transport */
  154.     "real-",                /* prefix */
  155. };
  156.  
  157. static struct director real_user_director = {
  158.     "real_user",            /* directing to real local users */
  159.     "user",                /* use the user driver */
  160.     SUCC,                /* point to next director */
  161.     0,                    /* no interesting flags */
  162.     NULL,                /* no address owner */
  163.     NULL,                /* no default user */
  164.     NULL,                /* no default group */
  165.     NULL,                /* no default home director */
  166.     NULL,                /* no explicit user */
  167.     NULL,                /* no explicit group */
  168.     NULL,                /* no explicit home directory */
  169.     (char *)&real_user_director_priv,    /* local private configuration */
  170.     0,                    /* cache - default uid */
  171.     0,                    /* cache - default gid */
  172.     NULL,                /* cache - expanded default home */
  173.     0,                    /* cache - set uid */
  174.     0,                    /* cache - set gid */
  175.     NULL,                /* cache - expanded set home */
  176. };
  177. #undef SUCC
  178. #define SUCC (&real_user_director)    /* setup for forward link */
  179.  
  180.  
  181. /*
  182.  * USER DIRECTOR:
  183.  *
  184.  * This matches users on the local host and associates them with the
  185.  * transport that appends to user mailbox files.
  186.  */
  187. static struct user_private user_director_priv = {
  188.     "local",                /* use the local transport */
  189.     NULL,                /* no prefix */
  190. };
  191.  
  192. static struct director user_director = {
  193.     "user",                /* directing to local users */
  194.     "user",                /* use the user driver */
  195.     SUCC,                /* point to next director */
  196.     0,                    /* no interesting flags */
  197.     NULL,                /* no address owner */
  198.     NULL,                /* no default user */
  199.     NULL,                /* no default group */
  200.     NULL,                /* no default home director */
  201.     NULL,                /* no explicit user */
  202.     NULL,                /* no explicit group */
  203.     NULL,                /* no explicit home directory */
  204.     (char *)&user_director_priv,    /* local private configuration */
  205.     0,                    /* cache - default uid */
  206.     0,                    /* cache - default gid */
  207.     NULL,                /* cache - expanded default home */
  208.     0,                    /* cache - set uid */
  209.     0,                    /* cache - set gid */
  210.     NULL,                /* cache - expanded set home */
  211. };
  212. #undef SUCC
  213. #define SUCC (&user_director)        /* setup for forward link */
  214.  
  215.  
  216. #ifdef    FORWARDTO_FILE
  217. /*
  218.  * FORWARDTO DIRECTOR:
  219.  *
  220.  * This looks for forwarding information in user mailbox files, for
  221.  * mailbox files that begin with "Forward to [addr list ...]".
  222.  */
  223. static struct forwardfile_private forwardto_director_priv = {
  224.     FORWARDTO_FILE,            /* Where to find forward to files */
  225. #ifndef UNIX_SYS5
  226.     0002,                /* mail group must write in SysV */
  227. #else
  228.     0022,                /* should not be very writable */
  229. #endif
  230. #ifdef FORWARDTO_CAUTION
  231.     FORWARDTO_CAUTION,
  232. #else
  233.     "0-10:uucp:daemon",            /* be cautious of some user's files */
  234. #endif
  235.     NULL,                /* nothing is `unsecure' */
  236.     "root",                /* can be owned by root */
  237.     NULL,                /* no group ownership restriction */
  238.     NULL,                /* no prefix */
  239.     NULL,                /* no suffix */
  240. };
  241.  
  242. static struct director forwardto_director = {
  243.     "forwardto",            /* directing through alias file */
  244.     "forwardfile",            /* use the forwardfile driver */
  245.     SUCC,                /* point to next director */
  246.     /*
  247.      * secure source of addresses, owner should be the user, use
  248.      * "nobody" for unsecure forward files
  249.      */
  250.     FWD_CHECKOWNER|FWD_FORWARDTO|NOBODY_DIRECTOR|SENDER_OKAY,
  251.     "Postmaster",            /* errors go to the user */
  252.     NULL,                /* no default user */
  253.     NULL,                /* no default group */
  254.     NULL,                /* no default home director */
  255.     NULL,                /* no explicit user */
  256.     NULL,                /* no explicit group */
  257.     NULL,                /* no explicit home directory */
  258.     (char *)&forwardto_director_priv,    /* dotforward private configuration */
  259.     0,                    /* cache - default uid */
  260.     0,                    /* cache - default gid */
  261.     NULL,                /* cache - expanded default home */
  262.     0,                    /* cache - set uid */
  263.     0,                    /* cache - set gid */
  264.     NULL,                /* cache - expanded set home */
  265. };
  266. #undef SUCC
  267. #define SUCC (&forwardto_director)    /* setup for forward link */
  268. #endif    /* FORWARDTO_FILE */
  269.  
  270.  
  271. #ifndef    DISABLE_DOTFORWARD
  272. /*
  273.  * DOTFORWARD DIRECTOR:
  274.  *
  275.  * This looks for .forward files in a user's home directory.
  276.  */
  277. static struct forwardfile_private dotforward_director_priv = {
  278.     "~/.forward",            /* .forward in home directories */
  279.     0002,                /* should not be globally writable */
  280. #ifdef DOTFWARD_CAUTION
  281.     DOTFORWARD_CAUTION,
  282. #else
  283.     "0-10:uucp:daemon",            /* be cautious of some forward file */
  284. #endif
  285.     /* remote access directories are very unsecure */
  286.     REMOTE_HOMES,
  287.     "root",                /* can be owned by root */
  288.     NULL,                /* no group ownership restriction */
  289.     NULL,                /* no prefix */
  290.     NULL,                /* no suffix */
  291. };
  292.  
  293. static struct director dotforward_director = {
  294.     "dotforward",            /* directing through alias file */
  295.     "forwardfile",            /* use the aliasfile driver */
  296.     SUCC,                /* point to next director */
  297.     /*
  298.      * secure source of addresses, owner should be the user, use "nobody"
  299.      * for unsecure forward files
  300.      */
  301.     FWD_CHECKOWNER|NOBODY_DIRECTOR|SENDER_OKAY,
  302.     "real-$user",            /* address errors go to user */
  303.     NULL,                /* no default user */
  304.     NULL,                /* no default group */
  305.     NULL,                /* no default home director */
  306.     NULL,                /* no explicit user */
  307.     NULL,                /* no explicit group */
  308.     NULL,                /* no explicit home directory */
  309.     (char *)&dotforward_director_priv,    /* dotforward private configuration */
  310.     0,                    /* cache - default uid */
  311.     0,                    /* cache - default gid */
  312.     NULL,                /* cache - expanded default home */
  313.     0,                    /* cache - set uid */
  314.     0,                    /* cache - set gid */
  315.     NULL,                /* cache - expanded set home */
  316. };
  317. #undef SUCC
  318. #define SUCC (&dotforward_director)    /* setup for forward link */
  319. #endif    /* DISABLE_DOTFORWARD */
  320.  
  321.  
  322. #ifdef    ALIASES_FILE
  323. /*
  324.  * ALIASFILE DIRECTOR:
  325.  *
  326.  * The name of the alias file and its access method type is defined in
  327.  * config.h, if an aliasfile is configured.
  328.  */
  329. static struct aliasfile_private aliases_director_priv = {
  330.     ALIASES_FILE,            /* this is set in config.h */
  331.     ALIASES_PROTO,            /* file access method */
  332.     0002,                /* should not be globally writable */
  333.     NULL,                /* no ownership restriction */
  334.     NULL,                /* no group ownership restriction */
  335. #ifdef    HAVE_RENAME
  336.     /*
  337.      * if we have an atomic rename call, retries should not be required
  338.      * since the file should always exist, even when being rebuilt
  339.      *
  340.      * if the file is not found, the aliases director is ignored.
  341.      */
  342.     0,                    /* no retries */
  343. #else    /* HAVE_RENAME */
  344.     /*
  345.      * without an atomic rename call, there will be short periods
  346.      * of time when the file does not exist, while it is being
  347.      * rebuilt
  348.      */
  349.     2,                    /* two retries on open */
  350. #endif    /* HAVE_RENAME */
  351.     2,                    /* two second intervals for retries */
  352.     0,                    /* temp - addr flags bit mask */
  353.     NULL,                /* temp - open database */
  354.     NULL,                /* temp - error from open */
  355. };
  356.  
  357. static struct director aliases_director = {
  358.     "aliases",                /* directing through alias file */
  359.     "aliasfile",            /* use the aliasfile driver */
  360.     SUCC,                /* point to next director */
  361. #if !defined(ALIASES_REMOVE_SENDER)
  362.     SENDER_OKAY |
  363. #endif
  364. #ifdef ALIASES_OPTIONAL
  365.     ALIAS_OPTIONAL |
  366. #endif
  367. #ifdef ALIASES_TRYAGAIN
  368.     ALIAS_TRYAGAIN |
  369. #endif
  370.     0,                    /* secure source of addresses */
  371.     "owner-$user",            /* errors go to owner-<alias-name> */
  372.     NULL,                /* no default user */
  373.     NULL,                /* no default group */
  374.     NULL,                /* no default home director */
  375.     NULL,                /* no explicit user */
  376.     NULL,                /* no explicit group */
  377.     NULL,                /* no explicit home directory */
  378.     (char *)&aliases_director_priv,    /* aliases private configuration */
  379.     0,                    /* cache - default uid */
  380.     0,                    /* cache - default gid */
  381.     NULL,                /* cache - expanded default home */
  382.     0,                    /* cache - set uid */
  383.     0,                    /* cache - set gid */
  384.     NULL,                /* cache - expanded set home */
  385. };
  386. #undef SUCC
  387. #define SUCC (&aliases_director)    /* setup for forward link */
  388. #endif    /* ALIASES_FILE */
  389.  
  390.  
  391. #if    !defined(DISABLE_DOTFORWARD) || defined(FORWARDTO_FILE)
  392. /*
  393.  * FORWARDINCLUDE DIRECTOR:
  394.  *
  395.  * This is configured only if the dotforward director is also
  396.  * configured in.  It is setup to copy security and ownership
  397.  * restrictions from the dotforward director.
  398.  */
  399. static struct director forwardinclude_director = {
  400.     "forwardinclude",            /* directing through include file */
  401.     "forwardinclude",            /* use the aliasinclude driver */
  402.     SUCC,                /* point to next director */
  403.     COPY_SECURE|COPY_OWNERS|        /* restrictions from forward file */
  404.         INC_CHECK_PATH|NOBODY_DIRECTOR,    /* make sure path is accessible */
  405.     NULL,                /* no address owner */
  406.     NULL,                /* no default user */
  407.     NULL,                /* no default group */
  408.     NULL,                /* no default home director */
  409.     NULL,                /* no explicit user */
  410.     NULL,                /* no explicit group */
  411.     NULL,                /* no explicit home directory */
  412.     NULL,                /* no private data */
  413.     0,                    /* cache - default uid */
  414.     0,                    /* cache - default gid */
  415.     NULL,                /* cache - expanded default home */
  416.     0,                    /* cache - set uid */
  417.     0,                    /* cache - set gid */
  418.     NULL,                /* cache - expanded set home */
  419. };
  420. #undef SUCC
  421. #define SUCC (&forwardinclude_director)    /* setup for forward link */
  422. #endif    /* !defined(DISABLE_DOTFORWARD) || defined(FORWARDTO_FILE) */
  423.  
  424.  
  425. #ifdef    ALIASES_FILE
  426. /*
  427.  * ALIASINCLUDE DIRECTOR:
  428.  *
  429.  * This is configured only if the aliases director is also configured
  430.  * in.  It is setup to copy security and ownership restrictions from
  431.  * the aliases file director.
  432.  */
  433. static struct director aliasinclude_director = {
  434.     "aliasinclude",            /* directing through include file */
  435.     "aliasinclude",            /* use the aliasinclude driver */
  436.     SUCC,                /* point to next director */
  437.     NOBODY_DIRECTOR|COPY_SECURE|COPY_OWNERS, /* restrictions from aliases */
  438.     NULL,                /* no address owner */
  439.     NULL,                /* no default user */
  440.     NULL,                /* no default group */
  441.     NULL,                /* no default home director */
  442.     NULL,                /* no explicit user */
  443.     NULL,                /* no explicit group */
  444.     NULL,                /* no explicit home directory */
  445.     NULL,                /* no private data */
  446.     0,                    /* cache - default uid */
  447.     0,                    /* cache - default gid */
  448.     NULL,                /* cache - expanded default home */
  449.     0,                    /* cache - set uid */
  450.     0,                    /* cache - set gid */
  451.     NULL,                /* cache - expanded set home */
  452. };
  453. #undef SUCC
  454. #define SUCC (&aliasinclude_director)    /* setup for forward link */
  455. #endif    /* ALIASES_FILE */
  456.  
  457.  
  458. /* point to the first director */
  459. struct director *directors = SUCC;
  460.  
  461.  
  462. /*
  463.  * START OF ROUTER DEFINITION SECTION
  464.  */
  465.  
  466. #undef SUCC
  467. #define SUCC    NULL            /* end of router list */
  468.  
  469. #ifdef USE_METHOD_TABLE
  470. /*
  471.  * method table used by pathalias router and uuname router
  472.  */
  473. static struct method method_table[] = {
  474. /* you could list sites you wish to poll on demand, for example:
  475.  *  { "ihnp4",    -1, -1, "demand" },
  476.  *  { "mcvax",    -1, -1, "demand" },
  477.  * if some sites require a different transport, make a transport
  478.  * entry and give its name instead of "demand" or "uux".
  479.  *
  480.  * The uux transport calls uux with the -r flag, so that requests are just
  481.  * queued, uucico is not started to perform delivery immediately.
  482.  */
  483.     { "*",    -1, -1, "uux" },    /* use "uux" for all other hosts */
  484.     { NULL,    -1, -1, 0},        /* end of first table */
  485. };
  486. # define METHOD_TABLE method_table
  487.  
  488. #else    /* not USE_METHOD_TABLE */
  489.  
  490. # define METHOD_TABLE NULL
  491.  
  492. #endif    /* not USE_METHOD_TABLE */
  493.  
  494.  
  495. #if    defined(SMART_PATH)
  496. /*
  497.  * SMARTHOST ROUTER:
  498.  *
  499.  * This router declares a remote host to which mail should be sent for
  500.  * hosts that we cannot resolve ourselves.  Presumably this remote
  501.  * host has a more complete or more up-to-date collection of routing
  502.  * databases than we do ourselves.
  503.  */
  504. static struct smarthost_private smarthost_router_priv = {
  505.     SMART_PATH,
  506.     NULL,
  507.     NULL,
  508. };
  509.  
  510. static struct router smarthost_router = {
  511.     "smart_host",            /* routing to smarthost */
  512.     "smarthost",            /* use the smarthost driver */
  513.     SUCC,                /* point to next router */
  514.     0,                    /* no options turned on */
  515.     METHOD_TABLE,            /* use method table, if non-NULL */
  516.     SMART_TRANSPORT,            /* default transport given */
  517.     (char *)&smarthost_router_priv,    /* smarthost private configuration */
  518. };
  519. #undef SUCC
  520. #define SUCC (&smarthost_router)    /* setup for forward link */
  521. #endif    /* defined(SMART_HOST) || defined(SMART_PATH) */
  522.  
  523.  
  524. #ifdef    UUNAME_COMMAND
  525. /*
  526.  * UUNAME ROUTER:
  527.  *
  528.  * The name for the uuname or a uuname-style program is configured in
  529.  * config.h, if one is to be used for finding neighboring host names.
  530.  */
  531. static struct uuname_private uuname_router_priv = {
  532.     UUNAME_COMMAND,            /* cmd attribute */
  533.     "uucp",                /* default domains */
  534.     NULL,                /* required domains */
  535. #ifdef UUCP_SYSTEM_FILE
  536.     UUCP_SYSTEM_FILE,            /* file to stat for changes */
  537. #else
  538.     NULL,
  539. #endif
  540.     NULL,                /* internal - cached output from cmd */
  541.     NULL,                /* internal - end of cached output */
  542.     NULL,                /* internal - processing error */
  543.     NULL,                /* internal - st_ino from stat */
  544.     NULL,                /* internal - st_mtime from stat */
  545. };
  546.  
  547. static struct router uuname_router = {
  548.     "uucp_neighbors",            /* routing through uuname output */
  549.     "uuname",                /* use the uuname driver */
  550.     SUCC,                /* point to next router */
  551.     0,                    /* no options turned on */
  552.     METHOD_TABLE,            /* use method table from pathalias */
  553.     UUNAME_TRANSPORT,            /* default transport */
  554.     (char *)&uuname_router_priv,    /* uuname private configuration */
  555. };
  556. #undef SUCC
  557. #define SUCC (&uuname_router)        /* setup for forward link */
  558. #endif    /* UUNAME_COMMAND */
  559.  
  560.  
  561. #ifdef    PATHS_FILE
  562. /*
  563.  * PATHALIAS ROUTER:
  564.  *
  565.  * The name of the paths file and the access method type is defined in
  566.  * config.h, if a pathalias database is configured.
  567.  */
  568. static struct pathalias_private pathalias_router_priv = {
  569.     PATHS_FILE,                /* file attribute */
  570.     PATHS_PROTO,            /* file access method */
  571.     "uucp",                /* default domain names */
  572.     NULL,                /* no required domain names */
  573. #ifdef    HAVE_RENAME
  574.     /*
  575.      * if we have an atomic rename call, retries should not be required
  576.      * since the file should always exist, even when being rebuilt
  577.      *
  578.      * if the file is not found, the pathalias director is ignored.
  579.      */
  580.     0,                    /* no retries */
  581. #else    /* HAVE_RENAME */
  582.     /*
  583.      * without an atomic rename call, there will be short periods
  584.      * of time when the file does not exist, while it is being
  585.      * rebuilt
  586.      */
  587.     2,                    /* two retries on open */
  588. #endif    /* HAVE_RENAME */
  589.     2,                    /* two second intervals for retries */
  590.     NULL,                /* internal - open database */
  591.     NULL,                /* internal - error text from open */
  592. };
  593.  
  594. static struct router pathalias_router = {
  595.     "paths",                /* routing through pathalias file */
  596.     "pathalias",            /* use the pathalias driver */
  597.     SUCC,                /* point to next router */
  598. #ifdef PATHS_OPTIONAL
  599.     PA_OPTIONAL|
  600. #endif
  601. #ifdef PATHS_TRYAGAIN
  602.     PA_TRYAGAIN|
  603. #endif
  604.     0,                /* no options turned on */
  605.     METHOD_TABLE,            /* use method table to find tport */
  606.     PATHS_TRANSPORT,            /* default transport */
  607.     (char *)&pathalias_router_priv,    /* pathalias private configuration */
  608. };
  609. #undef SUCC
  610. #define SUCC (&pathalias_router)    /* setup for forward link */
  611. #endif    /* PATHS_FILE */
  612.  
  613.  
  614. #ifdef    USE_GETHOSTBYNAME
  615. /*
  616.  * GETHOSTBYNAME ROUTER:
  617.  *
  618.  * Define a fairly generic interface to gethostbyname(3N)
  619.  */
  620.  
  621. static struct gethostbyname_private inet_hosts_router_priv = {
  622.     NULL,                /* no optional domain names */
  623.     NULL,                /* no required domain names */
  624. };
  625.  
  626. static struct router inet_hosts_router = {
  627.     "inet_hosts",            /* match hosts on an IP network */
  628.     "gethostbyname",            /* use the gethostbyname driver */
  629.     SUCC,                /* point to next router */
  630.     0,                    /* no options turned on */
  631.     METHOD_TABLE,            /* use method table to find tport */
  632.     GETHOSTBYNAME_TRANSPORT,        /* default transport */
  633.     (char *)&inet_hosts_router_priv,    /* private configuration */
  634. };
  635. #undef SUCC
  636. #define SUCC (&inet_hosts_router)    /* setup for forward link */
  637. #endif    /* USE_GETHOSTBYNAME */
  638.  
  639.  
  640. #ifdef    USE_GETHOSTBYADDR
  641. /*
  642.  * GETHOSTBYADDR ROUTER:
  643.  *
  644.  * Define a fairly generic interface to gethostbyaddr(3N) and the
  645.  * inet_addr(3N) routines.
  646.  */
  647.  
  648. static struct router inet_addrs_router = {
  649.     "inet_addrs",            /* match IP addrs on an IP network */
  650.     "gethostbyaddr",            /* use the gethostbyaddr driver */
  651.     SUCC,                /* point to next router */
  652.     GETHOST_FAIL_IFERR|GETHOST_CHECK_LOCAL, /* fail_if_error + check_local */
  653.     METHOD_TABLE,            /* use method table to find tport */
  654.     GETHOSTBYADDR_TRANSPORT,        /* default transport */
  655.     (char *)NULL,            /* no private configuration */
  656. };
  657. #undef SUCC
  658. #define SUCC (&inet_addrs_router)    /* setup for forward link */
  659. #endif    /* USE_GETHOSTBYADDR */
  660.  
  661.  
  662. #ifdef EXPERIMENTAL_REROUTER
  663.  
  664. /*
  665.  * REROUTE ROUTER:
  666.  *
  667.  * By default, this router is used only to collaps bang path addresses
  668.  * in bounce mails.  This has to be the first router in the calling
  669.  * sequence.
  670.  */
  671. static struct reroute_private reroute_router_priv = {
  672.     NULL,                /* no file attribute */
  673.     NULL,                /* no file access method */
  674.     NULL,                /* no default domain names */
  675.     NULL,                /* no required domain names */
  676.     0,                    /* no retries */
  677.     0,                    /* no retries */
  678.     NULL,                /* internal - open database */
  679.     NULL,                /* internal - error text from open */
  680. };
  681.  
  682. static struct router reroute_router = {
  683.     "reroute",                /* routing through rerouter */
  684.     "reroute",                /* use the reroute driver */
  685.     SUCC,                /* point to next router */
  686.     RR_MATCHLOCAL|RR_BOUNCEONLY,    /* default options */
  687.     METHOD_TABLE,            /* use method table to find tport */
  688.     PATHS_TRANSPORT,            /* default transport */
  689.     (char *)&reroute_router_priv,    /* reroute private configuration */
  690. };
  691. #undef SUCC
  692. #define SUCC (&reroute_router)        /* setup for forward link */
  693.  
  694. #endif    /* EXPERIMENTAL_REROUTER */
  695.  
  696.  
  697. /* point to the first router */
  698. struct router *routers = SUCC;
  699.  
  700.  
  701. /*
  702.  * START OF TRANSPORT DEFINITION SECTION
  703.  *
  704.  * The order is not important for transports.
  705.  */
  706.  
  707. #undef SUCC
  708. #define SUCC    NULL            /* end of transport list */
  709.  
  710. /*
  711.  * LOCAL TRANSPORT:
  712.  *
  713.  * Local mail delivery is done either by appending to a file, or by
  714.  * sending to a command.  If a command is defined, as LOCAL_MAIL_COMMAND
  715.  * in config.h, use it.  Otherwise a filename must be defined as
  716.  * LOCAL_MAIL_FILE.  Produce a compile error if nothing is configured.
  717.  */
  718. #ifdef    LOCAL_MAIL_COMMAND
  719. static struct pipe_private local_transport_priv = {
  720.     LOCAL_MAIL_COMMAND,            /* example "/bin/mail -d $($user$) */
  721.     NULL,                /* execute the program as nobody */
  722.     NULL,                /* no specific group */
  723.     0022,                /* umask for child process */
  724. };
  725.  
  726. static struct transport local_transport = {
  727.     "local",                /* local transport to users */
  728.     "pipe",                /* use the pipe driver */
  729.     SUCC,                /* point to next transport */
  730.     /* put Received:, Return-Path: and From_ line, will do local delivery */
  731.     PUT_RECEIVED | PUT_RETURNPATH | LOCAL_TPORT | LOCAL_XFORM | PUT_FROM |
  732.     UNIX_FROM_HACK |
  733.     PIPE_AS_USER,
  734. # ifdef    LOCAL_MAIL_ADDRS
  735.     /* if there is a specific limit on number of addrs from config.h,
  736.      * use that in assigning transport instances, otherwise limit is 1,
  737.      * 2000-char limit on addrs is an arbitrary large number.  Should
  738.      * always be noticeably smaller than NCARGS */
  739.     LOCAL_MAIL_ADDRS, 1, 2000,        /* limits for assigning transports */
  740. # else    /* LOCAL_MAIL_ADDRS */
  741.     1, 1, 0,                /* 1 addr, 1 host, size not useful */
  742. # endif    /* LOCAL_MAIL_ADDRS */
  743.     NULL, NULL, NULL,            /* hdrremove, hdrinsert, hdrappend */
  744.     NULL,                /* retry directory */
  745.     NULL,                /* shadow transport */
  746.     NULL,                /* error transport */
  747.     (char *)&local_transport_priv,    /* local private configuration */
  748. };
  749. #undef SUCC
  750. #define SUCC (&local_transport)        /* setup for forward link */
  751.  
  752. #else    /* LOCAL_MAIL_COMMAND */
  753.  
  754. static struct appendfile_private local_transport_priv = {
  755.     LOCAL_MAIL_FILE,            /* e.g.: /usr/spool/mail/${lc:user} */
  756.     NULL,                /* directory does not apply */
  757.     NULL,                /* run as the particular user */
  758. # ifdef    UNIX_SYS5
  759.     "mail",                /* under System V use group "mail" */
  760. # else
  761.     NULL,                /* otherwise, no group in particular */
  762. # endif
  763.     NULL,                /* no message prefix */
  764.     "\n",                /* end message with extra newline */
  765.     LOCAL_MAIL_MODE,            /* file creation mode */
  766. };
  767.  
  768. static struct transport local_transport = {
  769.     "local",                /* local transport to users */
  770.     "appendfile",            /* use the appendfile driver */
  771.     SUCC,                /* point to next transport */
  772.     /* put Received:, Return-Path: and From_ line, will do local delivery */
  773.     PUT_RECEIVED|PUT_RETURNPATH|LOCAL_TPORT|LOCAL_XFORM|PUT_FROM|
  774.     APPEND_AS_USER|UNIX_FROM_HACK|APPEND_COMSAT,
  775.     1, 1, 0,                /* 1 addr, 1 host, size not useful */
  776.     NULL, NULL, NULL,            /* hdrremove, hdrinsert, hdrappend */
  777.     NULL,                /* retry directory */
  778.     NULL,                /* shadow transport */
  779.     NULL,                /* error transport */
  780.     (char *)&local_transport_priv,    /* local private configuration */
  781. };
  782. #undef SUCC
  783. #define SUCC (&local_transport)        /* setup for forward link */
  784. #endif    /* LOCAL_MAIL_COMMAND */
  785.  
  786.  
  787. /*
  788.  * PIPE TRANSPORT:
  789.  *
  790.  * Run a shell command by piping the message to the shell.  Shell
  791.  * commands can only be produced if the aliasfile and forwardfile
  792.  * drivers are used.
  793.  */
  794. static struct pipe_private pipe_transport_priv = {
  795.     "/bin/sh -c $user",            /* command is passed as next_addr */
  796.     NULL,                /* use uid of the recipient */
  797.     NULL,                /* use gid of the recipient */
  798.     0022,                /* umask for child process */
  799. };
  800.  
  801. static struct transport pipe_transport = {
  802.     "pipe",                /* pipe transport to shell commands */
  803.     "pipe",                /* use the pipe driver */
  804.     SUCC,                /* point to next transport */
  805.     /* put Recieved:, Return-Path: and From_ line, will do local delivery */
  806.     PUT_RECEIVED | PUT_RETURNPATH | LOCAL_TPORT | LOCAL_XFORM | PUT_FROM |
  807.     UNIX_FROM_HACK |
  808.     PIPE_AS_USER | PIPE_PARENT_ENV | PIPE_IGNORE_STATUS | PIPE_IGNORE_WRERRS,
  809.     1, 1, 0,                /* 1 addr, 1 host, size not useful */
  810.     NULL, NULL, NULL,            /* hdrremove, hdrinsert, hdrappend */
  811.     NULL,                /* retry directory */
  812.     NULL,                /* shadow transport */
  813.     NULL,                /* error transport */
  814.     (char *)&pipe_transport_priv,    /* pipe private configuration */
  815. };
  816. #undef SUCC
  817. #define SUCC (&pipe_transport)        /* setup for forward link */
  818.  
  819.  
  820. /*
  821.  * FILE TRANSPORT:
  822.  *
  823.  * Append to a specific filename.  File addresses can only be produced
  824.  * if the aliasfile and forwardfile drivers are used.
  825.  */
  826. static struct appendfile_private file_transport_priv = {
  827.     "$user",                /* the file is passed as next_addr */
  828.     NULL,                /* no dir attribute */
  829.     NULL,                /* use uid of the recipient */
  830.     NULL,                /* use gid of the recipient */
  831.     NULL,                /* prefix string */
  832.     "\n",                /* suffix string */
  833.     0644,                /* mode for creation */
  834. };
  835.  
  836. static struct transport file_transport = {
  837.     "file",                /* append to specific files */
  838.     "appendfile",            /* use the apppendfile driver */
  839.     SUCC,                /* point to next transport */
  840.     /* put Recieved:, Return-Path: and From_ line, will do local delivery */
  841.     PUT_RECEIVED|PUT_RETURNPATH|LOCAL_TPORT|LOCAL_XFORM|PUT_FROM|UNIX_FROM_HACK|
  842.     /* also append to file with uid/gid from addr structure */
  843.     APPEND_AS_USER|
  844.     /* expand the user name so ~ expansions can occur */
  845.     APPEND_EXPAND_USER,
  846.     1, 1, 0,                /* 1 addr, 1 host, size not useful */
  847.     NULL, NULL, NULL,            /* hdrremove, hdrinsert, hdrappend */
  848.     NULL,                /* retry directory */
  849.     NULL,                /* shadow transport */
  850.     NULL,                /* error transport */
  851.     (char *)&file_transport_priv,    /* pipe private configuration */
  852. };
  853. #undef SUCC
  854. #define SUCC (&file_transport)        /* setup for forward link */
  855.  
  856.  
  857. /*
  858.  * UUX TRANSPORT:
  859.  *
  860.  * This calls uux with the -r flag so that actual delivery is not
  861.  * attempted immediately.  Presumably a cronjob will start up uucico at
  862.  * some later time to actually attempt to send the mail to the remote
  863.  * machine.
  864.  */
  865. static struct pipe_private uux_transport_priv = {
  866.     QUEUED_UUX_COMMAND,            /* queued uux to remote rmail */
  867.     /* to run uux as other than the nobody user, put the login name here */
  868.     NULL,                /* execute the program as nobody */
  869.     NULL,                /* no specific group */
  870.     0022,                /* umask for child process */
  871. };
  872.  
  873. static struct transport uux_transport = {
  874.     "uux",                /* queued transport over uux */
  875.     "pipe",                /* uses pipe transport driver */
  876.     SUCC,                /* point to next transport */
  877.     /* only use !-routes in message envelope, supply a Received: field
  878.      * and begin the message with a From_ line. */
  879.     UUCP_XFORM|PUT_RECEIVED|PUT_FROM|PIPE_AS_SENDER|PIPE_LOG_OUTPUT,
  880.     5, 1, 200,                /* 5 addresses, 1 host, 200 chars */
  881.     NULL, NULL, NULL,            /* hdrremove, hdrinsert, hdrappend */
  882.     NULL,                /* retry directory */
  883.     NULL,                /* shadow transport */
  884.     NULL,                /* error transport */
  885.     (char *)&uux_transport_priv,    /* uux private configuration */
  886. };
  887. #undef SUCC
  888. #define SUCC (&uux_transport)        /* setup for forward link */
  889.  
  890.  
  891. /*
  892.  * DEMAND TRANSPORT:
  893.  *
  894.  * This calls uux without the -r flag so that delivery is attempted
  895.  * immediately.
  896.  */
  897. static struct pipe_private demand_transport_priv = {
  898.     DEMAND_UUX_COMMAND,            /* demand uux to remote rmail */
  899.     /* to run uux as other than the nobody user, put the login name here */
  900.     NULL,                /* execute the program as nobody */
  901.     NULL,                /* no specific group */
  902.     0022,                /* umask for child process */
  903. };
  904.  
  905. static struct transport demand_transport = {
  906.     "demand",                /* queued transport over uux */
  907.     "pipe",                /* uses pipe transport driver */
  908.     SUCC,                /* point to next transport */
  909.     /* only use !-routes in message envelope, supply a Received: field
  910.      * and begin the message with a From_ line. */
  911.     UUCP_XFORM|PUT_RECEIVED|PUT_FROM|PIPE_AS_SENDER|PIPE_LOG_OUTPUT,
  912.     5, 1, 200,                /* 5 addresses, 1 host, 200 chars */
  913.     NULL, NULL, NULL,            /* hdrremove, hdrinsert, hdrappend */
  914.     NULL,                /* retry directory */
  915.     NULL,                /* shadow transport */
  916.     NULL,                /* error transport */
  917.     (char *)&demand_transport_priv,    /* demand private configuration */
  918. };
  919. #undef SUCC
  920. #define SUCC (&demand_transport)    /* setup for forward link */
  921.  
  922.  
  923. /*
  924.  * LOCAL UUX TRANSPORT:
  925.  *
  926.  * This calls uux with the -r flag so that actual delivery is not
  927.  * attempted immediately.  Presumably a cronjob will start up uucico at
  928.  * some later time to actually attempt to send the mail to the remote
  929.  * machine.
  930.  *
  931.  * The message is transferred in local format.
  932.  */
  933. static struct pipe_private local_uux_transport_priv = {
  934.     QUEUED_UUX_COMMAND,            /* queued uux to remote rmail */
  935.     /* to run uux as other than the nobody user, put the login name here */
  936.     NULL,                /* execute the program as nobody */
  937.     NULL,                /* no specific group */
  938.     0022,                /* umask for child process */
  939. };
  940.  
  941. static struct transport local_uux_transport = {
  942.     "local_uux",            /* queued transport over uux */
  943.     "pipe",                /* uses pipe transport driver */
  944.     SUCC,                /* point to next transport */
  945.     /* use local format, supply a Received: field
  946.      * and begin the message with a From_ line. */
  947.     LOCAL_XFORM|UUCP_XFORM|PUT_RECEIVED|PUT_FROM|PIPE_AS_SENDER|PIPE_LOG_OUTPUT,
  948.     5, 1, 200,                /* 5 addresses, 1 host, 200 chars */
  949.     NULL, NULL, NULL,            /* hdrremove, hdrinsert, hdrappend */
  950.     NULL,                /* retry directory */
  951.     NULL,                /* shadow transport */
  952.     NULL,                /* error transport */
  953.     (char *)&local_uux_transport_priv,    /* uux private configuration */
  954. };
  955. #undef SUCC
  956. #define SUCC (&local_uux_transport)    /* setup for forward link */
  957.  
  958.  
  959. /*
  960.  * LOCAL DEMAND TRANSPORT:
  961.  *
  962.  * This calls uux without the -r flag so that actual delivery is
  963.  * attempted immediately.
  964.  *
  965.  * The message is transferred in local format.
  966.  */
  967. static struct pipe_private ldemand_transport_priv = {
  968.     DEMAND_UUX_COMMAND,            /* demand uux to remote rmail */
  969.     /* to run uux as other than the nobody user, put the login name here */
  970.     NULL,                /* execute the program as nobody */
  971.     NULL,                /* no specific group */
  972.     0022,                /* umask for child process */
  973. };
  974.  
  975. static struct transport ldemand_transport = {
  976.     "local_demand",            /* demand transport over uux */
  977.     "pipe",                /* uses pipe transport driver */
  978.     SUCC,                /* point to next transport */
  979.     /* use local format supply a Received: field
  980.      * and begin the message with a From_ line. */
  981.     LOCAL_XFORM|PUT_RECEIVED|PUT_FROM|PIPE_AS_SENDER|PIPE_LOG_OUTPUT,
  982.     5, 1, 200,                /* 5 addresses, 1 host, 200 chars */
  983.     NULL, NULL, NULL,            /* hdrremove, hdrinsert, hdrappend */
  984.     NULL,                /* retry directory */
  985.     NULL,                /* shadow transport */
  986.     NULL,                /* error transport */
  987.     (char *)&ldemand_transport_priv,    /* demand private configuration */
  988. };
  989. #undef SUCC
  990. #define SUCC (&ldemand_transport)    /* setup for forward link */
  991.  
  992.  
  993. /*
  994.  * QUEUED UUSMTP TRANSPORT:
  995.  *
  996.  * This calls uux with the -r flag so that actual delivery is not
  997.  * attempted immediately.  Presumably a cronjob will start up uucico at
  998.  * some later time to actually attempt to send the mail to the remote
  999.  * machine.
  1000.  *
  1001.  * The message is transferred in uucp format.
  1002.  */
  1003. static struct pipe_private uusmtp_transport_priv = {
  1004.     QUEUED_UUSMTP_COMMAND,        /* queued uux to remote rsmtp */
  1005.     /* to run uux as other than the nobody user, put the login name here */
  1006.     NULL,                /* execute the program as nobody */
  1007.     NULL,                /* no specific group */
  1008.     0022,                /* umask for child process */
  1009. };
  1010.  
  1011. static struct transport uusmtp_transport = {
  1012.     "uusmtp",                /* demand transport over uux */
  1013.     "pipe",                /* uses pipe transport driver */
  1014.     SUCC,                /* point to next transport */
  1015.     /* supply a Received: field
  1016.      * and put an SMTP envelope around the message. */
  1017.     UUCP_XFORM|PUT_RECEIVED|BSMTP_TPORT|PIPE_AS_SENDER|PIPE_LOG_OUTPUT,
  1018.     0, 1, 0,                /* 1 host */
  1019.     NULL, NULL, NULL,            /* hdrremove, hdrinsert, hdrappend */
  1020.     NULL,                /* retry directory */
  1021.     NULL,                /* shadow transport */
  1022.     NULL,                /* error transport */
  1023.     (char *)&uusmtp_transport_priv,    /* demand private configuration */
  1024. };
  1025. #undef SUCC
  1026. #define SUCC (&uusmtp_transport)    /* setup for forward link */
  1027.  
  1028.  
  1029. /*
  1030.  * DEMAND UUSMTP TRANSPORT:
  1031.  *
  1032.  * This calls uux without the -r flag so that actual delivery is
  1033.  * attempted immediately.
  1034.  *
  1035.  * The message is transferred in uucp format.
  1036.  */
  1037. static struct pipe_private demand_uusmtp_transport_priv = {
  1038.     DEMAND_UUSMTP_COMMAND,        /* demand uux to remote rsmtp */
  1039.     /* to run uux as other than the nobody user, put the login name here */
  1040.     NULL,                /* execute the program as nobody */
  1041.     NULL,                /* no specific group */
  1042.     0022,                /* umask for child process */
  1043. };
  1044.  
  1045. static struct transport demand_uusmtp_transport = {
  1046.     "demand_uusmtp",            /* demand transport over uux */
  1047.     "pipe",                /* uses pipe transport driver */
  1048.     SUCC,                /* point to next transport */
  1049.     /* supply a Received: field
  1050.      * and put an SMTP envelope around the message. */
  1051.     PUT_RECEIVED|BSMTP_TPORT|PIPE_AS_SENDER|PIPE_LOG_OUTPUT,
  1052.     0, 1, 0,                /* 1 host */
  1053.     NULL, NULL, NULL,            /* hdrremove, hdrinsert, hdrappend */
  1054.     NULL,                /* retry directory */
  1055.     NULL,                /* shadow transport */
  1056.     NULL,                /* error transport */
  1057.     (char *)&demand_uusmtp_transport_priv, /* demand private configuration */
  1058. };
  1059. #undef SUCC
  1060. #define SUCC (&demand_uusmtp_transport)    /* setup for forward link */
  1061.  
  1062.  
  1063. /*
  1064.  * LOCAL QUEUED UUSMTP TRANSPORT:
  1065.  *
  1066.  * This calls uux with the -r flag so that actual delivery is not
  1067.  * attempted immediately.  Presumably a cronjob will start up uucico at
  1068.  * some later time to actually attempt to send the mail to the remote
  1069.  * machine.
  1070.  *
  1071.  * The message is transferred in local format.
  1072.  */
  1073. static struct pipe_private local_uusmtp_transport_priv = {
  1074.     QUEUED_UUSMTP_COMMAND,        /* queued uux to remote rsmtp */
  1075.     /* to run uux as other than the nobody user, put the login name here */
  1076.     NULL,                /* execute the program as nobody */
  1077.     NULL,                /* no specific group */
  1078.     0022,                /* umask for child process */
  1079. };
  1080.  
  1081. static struct transport local_uusmtp_transport = {
  1082.     "local_uusmtp",            /* demand transport over uux */
  1083.     "pipe",                /* uses pipe transport driver */
  1084.     SUCC,                /* point to next transport */
  1085.     /* supply a Received: field
  1086.      * and put an SMTP envelope around the message. */
  1087.     LOCAL_XFORM|PUT_RECEIVED|BSMTP_TPORT|PIPE_AS_SENDER|PIPE_LOG_OUTPUT,
  1088.     0, 1, 0,                /* 1 host */
  1089.     NULL, NULL, NULL,            /* hdrremove, hdrinsert, hdrappend */
  1090.     NULL,                /* retry directory */
  1091.     NULL,                /* shadow transport */
  1092.     NULL,                /* error transport */
  1093.     (char *)&local_uusmtp_transport_priv, /* demand private configuration */
  1094. };
  1095. #undef SUCC
  1096. #define SUCC (&local_uusmtp_transport)    /* setup for forward link */
  1097.  
  1098.  
  1099. /*
  1100.  * LOCAL DEMAND UUSMTP TRANSPORT:
  1101.  *
  1102.  * This calls uux without the -r flag so that actual delivery is
  1103.  * attempted immediately.
  1104.  *
  1105.  * The message is transferred in local format.
  1106.  */
  1107. static struct pipe_private ldemand_uusmtp_transport_priv = {
  1108.     DEMAND_UUSMTP_COMMAND,        /* demand uux to remote rsmtp */
  1109.     /* to run uux as other than the nobody user, put the login name here */
  1110.     NULL,                /* execute the program as nobody */
  1111.     NULL,                /* no specific group */
  1112.     0022,                /* umask for child process */
  1113. };
  1114.  
  1115. static struct transport ldemand_uusmtp_transport = {
  1116.     "local_demand_uusmtp",        /* demand transport over uux */
  1117.     "pipe",                /* uses pipe transport driver */
  1118.     SUCC,                /* point to next transport */
  1119.     /* supply a Received: field
  1120.      * and put an SMTP envelope around the message. */
  1121.     LOCAL_XFORM|PUT_RECEIVED|BSMTP_TPORT|PIPE_AS_SENDER|PIPE_LOG_OUTPUT,
  1122.     0, 1, 0,                /* 1 host */
  1123.     NULL, NULL, NULL,            /* hdrremove, hdrinsert, hdrappend */
  1124.     NULL,                /* retry directory */
  1125.     NULL,                /* shadow transport */
  1126.     NULL,                /* error transport */
  1127.     (char *)&ldemand_uusmtp_transport_priv,
  1128.                         /* demand private configuration */
  1129. };
  1130. #undef SUCC
  1131. #define SUCC (&ldemand_uusmtp_transport) /* setup for forward link */
  1132.  
  1133.  
  1134. /*
  1135.  * INET QUEUED UUSMTP TRANSPORT:
  1136.  *
  1137.  * This calls uux with the -r flag so that actual delivery is not
  1138.  * attempted immediately.  Presumably a cronjob will start up uucico at
  1139.  * some later time to actually attempt to send the mail to the remote
  1140.  * machine.
  1141.  *
  1142.  * The message is transferred in internet format.
  1143.  */
  1144. static struct pipe_private inet_uusmtp_transport_priv = {
  1145.     QUEUED_UUSMTP_COMMAND,        /* queued uux to remote rsmtp */
  1146.     /* to run uux as other than the nobody user, put the login name here */
  1147.     NULL,                /* execute the program as nobody */
  1148.     NULL,                /* no specific group */
  1149.     0022,                /* umask for child process */
  1150. };
  1151.  
  1152. static struct transport inet_uusmtp_transport = {
  1153.     "inet_uusmtp",            /* batched smtp transport over uux */
  1154.     "pipe",                /* uses pipe transport driver */
  1155.     SUCC,                /* point to next transport */
  1156.     /* supply a Received: field
  1157.      * and put an SMTP envelope around the message. */
  1158.     INET_XFORM|PUT_RECEIVED|BSMTP_TPORT|PIPE_AS_SENDER|PIPE_LOG_OUTPUT,
  1159.     0, 1, 0,                /* 1 host */
  1160.     NULL, NULL, NULL,            /* hdrremove, hdrinsert, hdrappend */
  1161.     NULL,                /* retry directory */
  1162.     NULL,                /* shadow transport */
  1163.     NULL,                /* error transport */
  1164.     (char *)&inet_uusmtp_transport_priv, /* demand private configuration */
  1165. };
  1166. #undef SUCC
  1167. #define SUCC (&inet_uusmtp_transport)    /* setup for forward link */
  1168.  
  1169.  
  1170. /*
  1171.  * LOCAL DEMAND UUSMTP TRANSPORT:
  1172.  *
  1173.  * This calls uux without the -r flag so that actual delivery is
  1174.  * attempted immediately.
  1175.  *
  1176.  * The message is transferred in internet format.
  1177.  */
  1178. static struct pipe_private idemand_uusmtp_transport_priv = {
  1179.     DEMAND_UUSMTP_COMMAND,        /* demand uux to remote rsmtp */
  1180.     /* to run uux as other than the nobody user, put the login name here */
  1181.     NULL,                /* execute the program as nobody */
  1182.     NULL,                /* no specific group */
  1183.     0022,                /* umask for child process */
  1184. };
  1185.  
  1186. static struct transport idemand_uusmtp_transport = {
  1187.     "inet_demand_uusmtp",        /* demand transport over uux */
  1188.     "pipe",                /* uses pipe transport driver */
  1189.     SUCC,                /* point to next transport */
  1190.     /* supply a Received: field
  1191.      * and put an SMTP envelope around the message. */
  1192.     INET_XFORM|PUT_RECEIVED|BSMTP_TPORT|PIPE_AS_SENDER|PIPE_LOG_OUTPUT,
  1193.     0, 1, 0,                /* 1 host */
  1194.     NULL, NULL, NULL,            /* hdrremove, hdrinsert, hdrappend */
  1195.     NULL,                /* retry directory */
  1196.     NULL,                /* shadow transport */
  1197.     NULL,                /* error transport */
  1198.     (char *)&idemand_uusmtp_transport_priv,
  1199.                         /* demand private configuration */
  1200. };
  1201. #undef SUCC
  1202. #define SUCC (&idemand_uusmtp_transport) /* setup for forward link */
  1203.  
  1204.  
  1205. #ifdef USE_SMTP_TRANSPORT
  1206.  
  1207. #ifndef SMTP_SHORT_TIMEOUT
  1208. #define SMTP_SHORT_TIMEOUT (5*60)    /* short timeout, 5 minutes */
  1209. #endif
  1210.  
  1211. #ifndef SMTP_LONG_TIMEOUT
  1212. #define SMTP_LONG_TIMEOUT (5*60*60)    /* long timeout, 2 hours */
  1213. #endif
  1214.  
  1215. #ifndef SMTP_SERVICE_ENTRY
  1216. #define SMTP_SERVICE_ENTRY "smtp"    /* use the "smtp" service */
  1217. #endif
  1218.  
  1219. /*
  1220.  * SMTP TRANSPORTS:
  1221.  *
  1222.  * This initiates an SMTP conversation with a remote host over TCP/IP.
  1223.  *
  1224.  * The "smtp" transport uses gets its "uucp_zone" attribute from the
  1225.  * EDITME file.
  1226.  *
  1227.  * The "uucp_zone_smtp" transport transfers in uucp format.
  1228.  * The "inet_zone_smtp" transport transfers in internet format.
  1229.  * The "local_smtp" transport transfers in local format.
  1230.  */
  1231. static struct tcpsmtp_private smtp_transport_priv = {
  1232.     SMTP_SHORT_TIMEOUT,
  1233.     SMTP_LONG_TIMEOUT,
  1234.     SMTP_SERVICE_ENTRY,
  1235. };
  1236.  
  1237. static struct transport smtp_transport = {
  1238.     "smtp",                /* smtp to remote host */
  1239.     "tcpsmtp",                /* uses smtp transport driver */
  1240.     SUCC,                /* point to next transport */
  1241.     /* write a Received: field, use UUCP_ZONE, as needed */
  1242.     PUT_RECEIVED
  1243. #ifdef UUCP_ZONE
  1244.     | UUCP_XFORM
  1245. #else
  1246.     | INET_XFORM
  1247. #endif
  1248.     ,
  1249.     0, 1, 0,                /* 1 host, no other limit */
  1250.     NULL, NULL, NULL,            /* hdrremove, hdrinsert, hdrappend */
  1251.     "smtp",                /* retry directory */
  1252.     NULL,                /* shadow transport */
  1253.     NULL,                /* error transport */
  1254.     (char *)&smtp_transport_priv,    /* no private configuration */
  1255. };
  1256. #undef SUCC
  1257. #define SUCC (&smtp_transport)        /* setup for forward link */
  1258.  
  1259. static struct transport uucp_zone_smtp_transport = {
  1260.     "uucp_zone_smtp",            /* smtp to remote uucp-zone host */
  1261.     "tcpsmtp",                /* uses smtp transport driver */
  1262.     SUCC,                /* point to next transport */
  1263.     /* write a Received: field, use UUCP_ZONE */
  1264.     PUT_RECEIVED | UUCP_XFORM,
  1265.     0, 1, 0,                /* 1 host, no other limit */
  1266.     NULL, NULL, NULL,            /* hdrremove, hdrinsert, hdrappend */
  1267.     "smtp",                /* retry directory */
  1268.     NULL,                /* shadow transport */
  1269.     NULL,                /* error transport */
  1270.     (char *)&smtp_transport_priv,    /* generic smtp private configuration */
  1271. };
  1272. #undef SUCC
  1273. #define SUCC (&uucp_zone_smtp_transport) /* setup for forward link */
  1274.  
  1275. static struct transport inet_zone_smtp_transport = {
  1276.     "inet_zone_smtp",            /* smtp to remote internet host */
  1277.     "tcpsmtp",                /* uses smtp transport driver */
  1278.     SUCC,                /* point to next transport */
  1279.     /* write a Received: field */
  1280.     PUT_RECEIVED | INET_XFORM,
  1281.     0, 1, 0,                /* 1 host, no other limit */
  1282.     NULL, NULL, NULL,            /* hdrremove, hdrinsert, hdrappend */
  1283.     "smtp",                /* retry directory */
  1284.     NULL,                /* shadow transport */
  1285.     NULL,                /* error transport */
  1286.     (char *)&smtp_transport_priv,    /* generic smtp private configuration */
  1287. };
  1288. #undef SUCC
  1289. #define SUCC (&inet_zone_smtp_transport) /* setup for forward link */
  1290.  
  1291. static struct transport local_smtp_transport = {
  1292.     "local_smtp",            /* smtp to local internet host */
  1293.     "tcpsmtp",                /* uses smtp transport driver */
  1294.     SUCC,                /* point to next transport */
  1295.     /* write a Received: field */
  1296.     PUT_RECEIVED|LOCAL_XFORM,
  1297.     0, 1, 0,                /* 1 host, no other limit */
  1298.     NULL, NULL, NULL,            /* hdrremove, hdrinsert, hdrappend */
  1299.     "smtp",                /* retry directory */
  1300.     NULL,                /* shadow transport */
  1301.     NULL,                /* error transport */
  1302.     (char *)&smtp_transport_priv,    /* generic smtp private configuration */
  1303. };
  1304. #undef SUCC
  1305. #define SUCC (&local_smtp_transport) /* setup for forward link */
  1306. #endif    /* USE_SMTP_TRANSPORT */
  1307.  
  1308.  
  1309. /* point to the first transport */
  1310. struct transport *transports = SUCC;
  1311. struct transport *builtin_transports = SUCC;
  1312.